package org.vgou.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
* 
* Copyright (c) 2011, vgou All rights reserved.
* 
* @since Nov 27, 2011
* @author <a href="mailto:jason.hxx@gmail.com">jason</a>
* @version Id: Business.java Nov 27, 2011
* @comment 商家实体类
* 
*/
@Entity
//更新一个对象时,会生成动态SQL,当属性值发生变化时，才会包含到UPDATE语句中
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
@Table(name = "business")
public class Business implements Serializable {

	private static final long serialVersionUID = -1445908223507857778L;
	
	/** 编号 **/
	@Id
	@GeneratedValue
	@Column(name="id", length=19)
	private long id;
	
	/** 关联用户 **/
	@OneToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="userid")
	private User user;
	
	/** 状态  1 未审核  2已审核 3 屏蔽 **/
	@Column(name="status", length=10, nullable=false)
	private int status = 1;
	
	/** 负责人真实姓名 **/
	@Column(name="realname", nullable=false)
	private String realName;
	
	/** 联系方式 **/
	@Column(name="contact", nullable=false)
	private String contact;
	
	/** 相应证件 **/
	@Column(name="papers")
	private String papers;
	
	/** 商家名称 **/
	@Column(name="businessname" ,nullable=false)
	private String businessName;
	
	/** 产品类型 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="categoryid")
	private Category category;
	
	/** 商品所属地区 **/
	@ManyToOne(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
	@JoinColumn(name="locationid")
	private Location location;
	
	/** 商家地址 **/
	@Column(name="address", nullable=false)
	private String address;
	
	/** 地理坐标 **/
	@Column(name="coord")
	private String coord;
	
	/** 描述 **/
	@Column(name="description")
	private String description;

	public Business() {
		super();
	}

	public Business(long id, User user, int status, String realName,
			String contact, String papers, String businessName,
			Category category, Location location, String address, String coord,
			String description) {
		super();
		this.id = id;
		this.user = user;
		this.status = status;
		this.realName = realName;
		this.contact = contact;
		this.papers = papers;
		this.businessName = businessName;
		this.category = category;
		this.location = location;
		this.address = address;
		this.coord = coord;
		this.description = description;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getContact() {
		return contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	public String getPapers() {
		return papers;
	}

	public void setPapers(String papers) {
		this.papers = papers;
	}

	public String getBusinessName() {
		return businessName;
	}

	public void setBusinessName(String businessName) {
		this.businessName = businessName;
	}

	public Category getCategory() {
		return category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCoord() {
		return coord;
	}

	public void setCoord(String coord) {
		this.coord = coord;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
}
